FBoolSetter Struct Reference

Class definition for objects that help resetting boolean variables. More...

#include <fcleanup.h>

Public Member Functions

 FBoolSetter (bool &_toSet)
 Constructor. _toSet is a reference to the boolean that is set to TRUE immediately in this constructor call and gets reset to FALSE when this FBoolSetter object's destructor is executed.
 ~FBoolSetter ()
 Destructor. Resets the at construction time passed boolean to FALSE.

Data Fields

bool & toSet
 Remembers the boolean that is to be reset during destruction.

Detailed Description

Class definition for objects that help resetting boolean variables.

A stack allocated object of this type autonomically sets an at construction time passed boolean variable immediately to TRUE and resets the same variable to FALSE when it reaches the end of its own scope.

Intended usage:

   bool theBoolean = false;
   {
      Steinberg::FBoolSetter theBoolSetter (theBoolean);
      // Here the constructor of theBoolSetter sets theBoolean to TRUE.

      // Do something.

   } // Here the destructor of theBoolSetter resets theBoolean to FALSE.

Constructor & Destructor Documentation

FBoolSetter ( bool &  _toSet  )  [inline]

Constructor. _toSet is a reference to the boolean that is set to TRUE immediately in this constructor call and gets reset to FALSE when this FBoolSetter object's destructor is executed.

~FBoolSetter (  )  [inline]

Destructor. Resets the at construction time passed boolean to FALSE.


Field Documentation

bool& toSet

Remembers the boolean that is to be reset during destruction.

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.